package com.neuedu.yyzxproject.interceptor;

import com.neuedu.yyzxproject.utils.JwtUtil;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.HandlerInterceptor;

//public class JwtTokenInterceptor implements HandlerInterceptor {
//
//    //todo  拦截器配置
////    @Override
////    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
////
////        String token = request.getHeader("Authorization");
////        System.out.println("Received token: " + token);
////        if (token == null || !JwtUtil.validateToken(token)) {
////            response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
////            response.getWriter().write("Invalid or missing token");
////            return false;
////        }
////
////        String username = JwtUtil.getUsernameFromToken(token);
////        request.setAttribute("username", username);
////        return true;
////    }
//}
